package co.fitstart.entity.course;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

import co.fitstart.entity.course.round.CourseRound;
import co.fitstart.entity.courseware.assessment.BasicForceOption;

/**
 * 成果报告
 * @author haiyan_xiao
 *
 */
@Entity
@Table(name = "result_report")
@JsonIgnoreProperties(value={"hibernate_lazy_initializer","handler","fieldHandler"})
public class ResultReport {
    @Id
    @GeneratedValue
    private Long id;
    
    /** 对应课次 */
    @ManyToOne(fetch = FetchType.LAZY, optional = false)
    private CourseRound courseRound;
    
    /** 静蹲 */
    @Enumerated(EnumType.ORDINAL)
    private BasicForceOption staticSquat;
    
    /** 俯卧撑 */
    @Enumerated(EnumType.ORDINAL)
    private BasicForceOption pushUp;
    
    /** 两头起 */
    @Enumerated(EnumType.ORDINAL)
    private BasicForceOption vUp;
    
    /** 基础力量后续计划 */
    private String basicForcePlan;
    
    /** 波比跳类型：false: 简化；true:标准 */
    @Column(name = "is_standard_bobi")
    private Boolean standardBobi;
    
    /** 波比跳个数 */
    private Integer bobi;
    
    /** 心肺测试-其他 */
    private String heartLungRemark;
    
    /** 心肺后续计划 */
    private String heartLungPlan;
    
    /** 其它 */
    private String remark;
    
    /** 其他后续计划 */
    private String otherPlan;
    
    /** 学员总结 */
    private String studentSummary;
    
    /** 教练总结 */
    private String coachSummary;
    
    /** 学员对教练想说的话 */
    private String wordsToCoach;
    
    /** 教练对学员想说的话 */
    private String wordsToStudent;
    
    /** 对比照-入营前 */
    private String previousPicture;
    
    /** 对比照-入营前(第几次上传) */
    private Integer previousVersion;
    
    /** 对比照-结营后 */
    private String latterPicture;
    
    /** 对比照-结营后(第几次上传) */
    private Integer latterVersion;
    
    @Column(name = "is_disabled")
    private boolean disabled;
    
    public ResultReport() {
        
    }
    
    public ResultReport(CourseRound courseRound) {
        this.courseRound = courseRound;
    }
    
    /**
     * initilization
     * @param courseRound
     * @return
     */
    public ResultReport initilization(CourseRound courseRound) {
        this.courseRound = courseRound;
        this.disabled = false;
        
        return this;
    }
    
    /**
     * edit change
     * @param resultReport
     * @return
     */
    public ResultReport editChange(ResultReport resultReport) {
        this.staticSquat = resultReport.getStaticSquat();
        this.pushUp = resultReport.getPushUp();
        this.vUp = resultReport.getvUp();
        this.basicForcePlan = resultReport.getBasicForcePlan();
        this.standardBobi = resultReport.getStandardBobi();
        this.bobi = resultReport.getBobi();
        this.heartLungRemark = resultReport.getHeartLungRemark();
        this.heartLungPlan = resultReport.getHeartLungPlan();
        this.remark = resultReport.getRemark();
        this.otherPlan = resultReport.getOtherPlan();
        
        return this;
    }
    
    /**
     * edit studentSummary & wordsToCoach
     * @param studentSummary
     * @param wordsToCoach
     * @return
     */
    public ResultReport editStudentSummary(String studentSummary, String wordsToCoach) {
        this.studentSummary = studentSummary;
        this.wordsToCoach = wordsToCoach;
        
        return this;
    }
    
    /**
     * edit coachSummary & wordsToStudent
     * @param coachSummary
     * @param wordsToStudent
     * @return
     */
    public ResultReport editCoachSummary(String coachSummary, String wordsToStudent) {
        this.coachSummary = coachSummary;
        this.wordsToStudent = wordsToStudent;
        
        return this;
    }
    
    /**
     * 
     * @param previousPicture
     * @return
     */
    public ResultReport editPicture(String path, String suffix) {
        if("before".equals(suffix)) {
            if(this.previousPicture != null && this.previousVersion == null) {
                this.previousVersion = 1;
            } else if(this.previousPicture != null) {
                this.previousVersion++;
            }
            this.previousPicture = path;
        } else if("after".equals(suffix)) {
            if(this.latterPicture != null && this.latterVersion == null) {
                this.latterVersion = 1;
            } else if(this.latterPicture != null) {
                this.latterVersion++;
            }
            this.latterPicture = path;
        }
        
        return this;
    }

    /**
     * @return the id
     */
    public Long getId() {
        return id;
    }

    /**
     * @param id the id to set
     */
    public void setId(Long id) {
        this.id = id;
    }

    /**
     * @return the courseRound
     */
    public CourseRound getCourseRound() {
        return courseRound;
    }

    /**
     * @param courseRound the courseRound to set
     */
    public void setCourseRound(CourseRound courseRound) {
        this.courseRound = courseRound;
    }

    /**
     * @return the staticSquat
     */
    public BasicForceOption getStaticSquat() {
        return staticSquat;
    }

    /**
     * @param staticSquat the staticSquat to set
     */
    public void setStaticSquat(BasicForceOption staticSquat) {
        this.staticSquat = staticSquat;
    }

    /**
     * @return the pushUp
     */
    public BasicForceOption getPushUp() {
        return pushUp;
    }

    /**
     * @param pushUp the pushUp to set
     */
    public void setPushUp(BasicForceOption pushUp) {
        this.pushUp = pushUp;
    }

    /**
     * @return the vUp
     */
    public BasicForceOption getvUp() {
        return vUp;
    }

    /**
     * @param vUp the vUp to set
     */
    public void setvUp(BasicForceOption vUp) {
        this.vUp = vUp;
    }

    /**
     * @return the basicForcePlan
     */
    public String getBasicForcePlan() {
        return basicForcePlan;
    }

    /**
     * @param basicForcePlan the basicForcePlan to set
     */
    public void setBasicForcePlan(String basicForcePlan) {
        this.basicForcePlan = basicForcePlan;
    }

    /**
     * @return the standardBobi
     */
    public Boolean getStandardBobi() {
        return standardBobi;
    }

    /**
     * @param standardBobi the standardBobi to set
     */
    public void setStandardBobi(Boolean standardBobi) {
        this.standardBobi = standardBobi;
    }

    /**
     * @return the bobi
     */
    public Integer getBobi() {
        return bobi;
    }

    /**
     * @param bobi the bobi to set
     */
    public void setBobi(Integer bobi) {
        this.bobi = bobi;
    }

    /**
     * @return the heartLungRemark
     */
    public String getHeartLungRemark() {
        return heartLungRemark;
    }

    /**
     * @param heartLungRemark the heartLungRemark to set
     */
    public void setHeartLungRemark(String heartLungRemark) {
        this.heartLungRemark = heartLungRemark;
    }

    /**
     * @return the heartLungPlan
     */
    public String getHeartLungPlan() {
        return heartLungPlan;
    }

    /**
     * @param heartLungPlan the heartLungPlan to set
     */
    public void setHeartLungPlan(String heartLungPlan) {
        this.heartLungPlan = heartLungPlan;
    }

    /**
     * @return the remark
     */
    public String getRemark() {
        return remark;
    }

    /**
     * @param remark the remark to set
     */
    public void setRemark(String remark) {
        this.remark = remark;
    }

    /**
     * @return the otherPlan
     */
    public String getOtherPlan() {
        return otherPlan;
    }

    /**
     * @param otherPlan the otherPlan to set
     */
    public void setOtherPlan(String otherPlan) {
        this.otherPlan = otherPlan;
    }

    /**
     * @return the studentSummary
     */
    public String getStudentSummary() {
        return studentSummary;
    }

    /**
     * @param studentSummary the studentSummary to set
     */
    public void setStudentSummary(String studentSummary) {
        this.studentSummary = studentSummary;
    }

    /**
     * @return the coachSummary
     */
    public String getCoachSummary() {
        return coachSummary;
    }

    /**
     * @param coachSummary the coachSummary to set
     */
    public void setCoachSummary(String coachSummary) {
        this.coachSummary = coachSummary;
    }

    /**
     * @return the wordsToCoach
     */
    public String getWordsToCoach() {
        return wordsToCoach;
    }

    /**
     * @param wordsToCoach the wordsToCoach to set
     */
    public void setWordsToCoach(String wordsToCoach) {
        this.wordsToCoach = wordsToCoach;
    }

    /**
     * @return the wordsToStudent
     */
    public String getWordsToStudent() {
        return wordsToStudent;
    }

    /**
     * @param wordsToStudent the wordsToStudent to set
     */
    public void setWordsToStudent(String wordsToStudent) {
        this.wordsToStudent = wordsToStudent;
    }

    /**
     * @return the previousPicture
     */
    public String getPreviousPicture() {
        return previousPicture;
    }

    /**
     * @param previousPicture the previousPicture to set
     */
    public void setPreviousPicture(String previousPicture) {
        this.previousPicture = previousPicture;
    }

    /**
     * @return the previousVersion
     */
    public Integer getPreviousVersion() {
        return previousVersion;
    }

    /**
     * @param previousVersion the previousVersion to set
     */
    public void setPreviousVersion(Integer previousVersion) {
        this.previousVersion = previousVersion;
    }

    /**
     * @return the latterPicture
     */
    public String getLatterPicture() {
        return latterPicture;
    }

    /**
     * @param latterPicture the latterPicture to set
     */
    public void setLatterPicture(String latterPicture) {
        this.latterPicture = latterPicture;
    }

    /**
     * @return the latterVersion
     */
    public Integer getLatterVersion() {
        return latterVersion;
    }

    /**
     * @param latterVersion the latterVersion to set
     */
    public void setLatterVersion(Integer latterVersion) {
        this.latterVersion = latterVersion;
    }

    /**
     * @return the disabled
     */
    public boolean isDisabled() {
        return disabled;
    }

    /**
     * @param disabled the disabled to set
     */
    public void setDisabled(boolean disabled) {
        this.disabled = disabled;
    }
}
